package com.wuf.mybatis.session;

import com.wuf.mybatis.builder.xml.XMLConfigBuilder;
import com.wuf.mybatis.session.defaults.DefaultSqlSessionFactory;

import java.io.Reader;

/**
 * @Author wuf
 * @Description 构建SqlSessionFactory的工厂
 * @PackageName wuf-mybatis
 * @Package com.wuf.mybatis.session
 * @Date 2024/4/24 15:30
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(Reader reader){

        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(reader);
        return build(xmlConfigBuilder.parse());
    }


    public SqlSessionFactory build(Configuration config) {
        return new DefaultSqlSessionFactory(config);
    }

}
